package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.ChildVaccineBean;
import com.xuxin.baby.contract.ChildVaccineContract;
import com.xuxin.baby.model.ChildVaccineModel;

/**
 * Created by xu_xin
 * Created on 2020/11/20 0020
 * 疫苗
 */
public class ChildVaccinePresenter implements ChildVaccineContract.Presenter {
    private final ChildVaccineModel model;
    private final ChildVaccineContract.View view;

    public ChildVaccinePresenter(ChildVaccineContract.View view) {
        this.view = view;
        model = new ChildVaccineModel();
    }

    @Override
    public void getChildVaccine(String tenantId, String token, int skipCount) {
        model.getChildVaccine(this, tenantId, token, skipCount);
    }

    @Override
    public void onSuccess(ChildVaccineBean childVaccineBean) {
        if (null != view) {
            view.onSuccess(childVaccineBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}